﻿using System;
using System.Collections.Generic;

using SBPweb.Communication.Shared.Library;
using SBPweb.Communication.Shared.Library.Contacts;
using SBPweb.Communication.Shared.Library.Connections;

using SBPweb.Communication.Client.Library.Xmpp.Contacts;

namespace SBPweb.Communication.Client.Library.Xmpp.Connections
{

    public partial class ConnectionManager : ConnectionManagerBase
    {
        
        #region Private fields

        private static List<ContactPresenceStateBase> ContactPresences;

        #endregion

        #region Constructor logic

        static ConnectionManager()
        {
            ContactPresences = new List<ContactPresenceStateBase>();
            ContactPresences.Add(new ContactPresenceState(AvailabilityTypes.None, string.Empty));
            ContactPresences.Add(new ContactPresenceState(AvailabilityTypes.Available, string.Empty));
            ContactPresences.Add(new ContactPresenceState(AvailabilityTypes.Away, string.Empty));
            ContactPresences.Add(new ContactPresenceState(AvailabilityTypes.DoNotDisturb, string.Empty));
            ContactPresences.Add(new ContactPresenceState(AvailabilityTypes.ExtendedAway, string.Empty));
        }

        internal ConnectionManager(MessengerBase messenger)
            : base(messenger)
        {
        }

        #endregion

        #region Methods

        #region State management

        public override List<ContactPresenceStateBase> EnumeratePresenceStates()
        {
            return ContactPresences;
        }

        #endregion

        #endregion

    }

    //public class ConnectionManager
    //{

    //    #region Private fields

    //    private Matrix.Xmpp.Client.XmppClient client = new Matrix.Xmpp.Client.XmppClient();

    //    #endregion

    //    #region Constructor logic

    //    public ConnectionManager()
    //    {
    //        client.OnAuthError += new EventHandler<Matrix.Xmpp.Sasl.SaslEventArgs>(client_OnAuthError);
    //        client.OnLogin += new EventHandler<Matrix.EventArgs>(client_OnLogin);
    //    }

    //    #endregion

    //    #region Methods

    //    public void Connect()
    //    {
    //        client.XmppDomain = "jabber.org";
    //        client.Hostname = "jabber.org";
    //        client.Port = 5222;
            
    //        client.ProxyType = Matrix.Net.Proxy.ProxyType.HttpTunnel;
    //        client.ProxyPort = 4503;
    //        //client.ProxyHostname = "localhost";
    //        client.ProxyHostname = "matrix.ag-software.de";

    //        client.Resource = "SBPweb.Communication.Client.Library.Xmpp.SL";

    //        //client.AnonymousLogin = true;
    //        client.Open();
    //    }

    //    private void client_OnAuthError(object sender, Matrix.Xmpp.Sasl.SaslEventArgs e)
    //    {
    //        throw new NotImplementedException();
    //    }

    //    private void client_OnLogin(object sender, Matrix.EventArgs e)
    //    {
    //    }

    //    #endregion

    //}

}